LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LIBMAD 	    := libmad-0.15.1b
LOCAL_SRC_FILES:= \
	$(LIBMAD)/version.c \
	$(LIBMAD)/fixed.c \
	$(LIBMAD)/bit.c \
	$(LIBMAD)/timer.c \
	$(LIBMAD)/stream.c \
	$(LIBMAD)/frame.c  \
	$(LIBMAD)/synth.c \
	$(LIBMAD)/decoder.c \
	$(LIBMAD)/layer12.c \
	$(LIBMAD)/layer3.c \
	$(LIBMAD)/huffman.c \

LOCAL_ARM_MODE := arm
LOCAL_MODULE:= libmad

LOCAL_C_INCLUDES := \
    $(LOCAL_PATH)/$(LIBMAD)/android 
    
LOCAL_CFLAGS := -DHAVE_CONFIG_H -ffast-math -O3 -DFPM_DEFAULT

ifneq (,$(filter $(TARGET_ARCH),arm))
	LOCAL_CFLAGS+= -DFPM_ARM
endif

ifeq ($(TARGET_ARCH),arm64)
	LOCAL_CFLAGS+= -DFPM_64BIT
endif

ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
	LOCAL_CFLAGS+= -DFPM_INTEL
endif

include $(BUILD_STATIC_LIBRARY)